$(function(){
	
	//发帖
	$("#creat-new-post-btn").click(function() {
		showLayer('发帖',$("#create-new-post-layer"));
	});
	
	$("#post-creat-btn").click(function() {
		
		window.location.reload();
	});
	
	//管理版块帖子
	$("#manage-module-post").click(function() {
		showLayer('管理帖子',$("#module-post-manage-layer"));
		
	});
	
	$("#module-post-change-btn").click(function(){
		
		window.location.reload();
	});
	
	//管理版块信息
	$("#manage-module-info").click(function() {
		showLayer('管理版块信息',$("#module-info-manage-layer"));
		
	});	
	
	$("#edit-module-btn").click(function() {
		
		window.location.reload();
	});
	
	
	
	var showModuleDescripBtn = $("#show-module-description");
	showModuleDescripBtn.click(function(){
		if(showModuleDescripBtn[0].className == "fa fa-chevron-circle-right"){
			showModuleDescripBtn[0].setAttribute("class","fa fa-chevron-circle-down");
		}else if(showModuleDescripBtn[0].className == "fa fa-chevron-circle-down"){
			showModuleDescripBtn[0].setAttribute("class","fa fa-chevron-circle-right");
		}
	});
	
});

var showLayer = function(name, layerContent){
	var index = layer.open({
		type:1,
		title: ''+name+'',
		fixed: false, //不固定
		maxmin: true,
		closeBtn: 1,
		scrollbar: false,
		area: 'auto',
		content: layerContent
	});
	layer.full(index);
}

var init = function() {
	var editorTask = new wangEditor('editor-task');
	editorTask.config.menus = [
	    'fullscreen',
	    ' | ',
		'bold',
		'underline',
		'italic',
		'strikethrough',
		'eraser',
		'forecolor',
		'bgcolor',
		'quote',
		'fontfamily',
		'fontsize',
		'head',
		'unorderlist',
		'orderlist',
		'alignleft',
		'aligncenter',
		'alignright',
		'link',
		'unlink',
		'table',
		'emotion',
		'img',
		'video',
		'insertcode',
		'undo',
		'redo'
    ];
	
	/*editorTask.config.uploadImgUrl = CONTEXT_PATH + 'resource/editUpload';
	editorTask.config.uploadImgFileName='editor-task';
	editorTask.config.zindex = 20000;*/
	editorTask.create();
}

var initAnswer = function() {
	var editorTask = new wangEditor('editor-answer');
	editorTask.config.menus = [
	    'fullscreen',
	    ' | ',
		'bold',
		'underline',
		'italic',
		'strikethrough',
		'eraser',
		'forecolor',
		'bgcolor',
		'quote',
		'fontfamily',
		'fontsize',
		'head',
		'unorderlist',
		'orderlist',
		'alignleft',
		'aligncenter',
		'alignright',
		'link',
		'unlink',
		'table',
		'emotion',
		'img',
		'video',
		'insertcode',
		'undo',
		'redo'
    ];
	
	/*editorTask.config.uploadImgUrl = CONTEXT_PATH + 'resource/editUpload';
	editorTask.config.uploadImgFileName='editor-answer';
	editorTask.config.zindex = 20000;*/
	editorTask.create();
}